import request from '@/config/axios'
import type { UserLoginType, MobileLoginType } from './types'

// 用户名密码登录接口
export const loginApi = (data: UserLoginType): Promise<IResponse<string>> => {
  return request.post({ url: '/auth/login', data })
}

// 手机短信验证码登录接口
export const mobileLoginApi = (data: MobileLoginType): Promise<IResponse<string>> => {
  return request.post({ url: '/auth/mobileLogin', data })
}

// 获取个人信息
export const authInfoApi = (data: string): Promise<IResponse> => {
  return request.get({ url: '/auth/info', data })
}

// 退出登录
export const loginOutApi = (): Promise<IResponse> => {
  return request.post({ url: '/auth/logout' })
}
